package com.android.topview.watermelon.account.dao

import androidx.room.*
import com.android.topview.watermelon.account.entity.Account

@Dao
interface AccountDao {
    @Insert
    fun insertAccount(account:Account):Long

    @Update
    fun updateAccount(newAccount: Account)


    @Query("select * from Account")
    fun loadAllAccounts():List<Account>

    @Query("select * from Account where date = :date ")
    fun loadAccountsByTime(date:String):List<Account>


    @Delete
    fun deleteAccount(account: Account)


    @Query("select * from account where is_cost = :flag order by date desc")
    fun loadIncomeOrCost(flag:Boolean):List<Account>

}